package  
{
  import com.bit101.components.PushButton;
  import flash.display.Sprite;
  import flash.events.Event;
	/**
   * ...
   * @author ivan
   */
  public class SharedEventsChild extends Sprite
  {
    
    public function SharedEventsChild() 
    {
      addEventListener("SharedEvent", onSharedEvent);
      
      new PushButton(this, 10, 50, "ChildEvent", onChildEvent);
      trace("Child created");
    }
    
    private function onChildEvent(e:Event):void
    {
        var event:SharedEvent = new SharedEvent("SharedEvent");
        this.dispatchEvent(event);
    }
    
    private function onSharedEvent(e:Event):void
    {
        trace("Child: Event received!");
    }
    
  }

}